<!doctype html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/style.css" />
	
		<!--App自定义的css-->
		<link rel="stylesheet" type="text/css" href="../css/app.css" />
		<link rel="stylesheet" type="text/css" href="../css/mui.picker.min.css" />
		<script src="../js/mui.min.js"></script>		
		<script src="../js/mui.picker.min.js"></script>
		<script src="../js/jquery-1.8.0.min.js"></script>
		<style>
			.file{position: absolute;top: 0rem;right:0.1rem ;z-index: 1;opacity: 0;}
			.kong{background: #efeff4;}
			input{font-size: 14px!important;}
			.mui-btn-blue{background: #ff7e00!important;border: none!important;}
			.diqu-div span{font-size: 14px;color: #323232;}
			.diqu-div{text-align: center;padding: 5px 0px;color:#ff7e00;}
		    .diqu-container{position: relative;}
		    .diqu-ul{position: absolute;top: 0px;left: 0px;width: 100%;padding: 5px;}
		    .diqu-ul li{margin: 5px;padding:0px 10px;color: #323232;font-size: 14px;height: 30px;line-height: 30px;border-bottom: 1px dashed #ccc;overflow: hidden;}
		    .city,.town{display: none;}
		    .diqu-ul li span:nth-of-type(2){float: right;font-size: 16px;color: #666;}
		    .quyu{display: none;}
		    .none{display: none;}
		    .jiahao{font-size: 14px;position: absolute;top: 10px;right: 5px;color: #fff;}
		    .ch-ph-btn{margin: 3.5rem auto;}
		</style>
	</head>
	<body style="background: #FFFFFF;">
	<div class="mui-bar mui-bar-nav ding-bar"style="position: fixed;top: 0px;width: 100%;left: 0px;" >
		<div style="position: relative;">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title" >社区详情</h1>
		    <span class="jiahao none" id="del" >删除</span>
		</div>
	</div>
	<div style="height: 44px;"></div>
		<div class="mui-content" style="background: #FFFFFF;">
		    <form class="changep-form" style="background: #fff;">
		    	<p><span>互助标题：</span><strong id="title"></strong></p>
		    	<p><span>开始时间：</span>
		    		<strong id="addtime"></strong>
		    	</p>
		    	<p><span>结束时间：</span>
		    		<strong id="endtime"></strong>
		    	</p>
		    	<p><span>互助薪酬：</span>
		    		<strong id="price"></strong>
		    	</p>
		    	<p>
		    		<span>联系人：</span>
		    		<strong id="linkname"></strong>
		    	</p>
		    	<p>
		    		<span>联系电话：</span>
		    		<strong id="linkphone"></strong>
		    	</p>
		    	<p style="border-bottom: none;">
		    		<span>互助内容：</span>
		    		
		    	</p>
		    	<div id="content" style="margin: 0px 5% ;line-height: px;font-size: 14px;color: #323232;"></div>
		        <div style="padding: 2px 0px;" class="none" id="xiugai-btn">
		        	 <button class="ch-ph-btn " id="xiugai" type="button" style="font-weight: bold;letter-spacing: 2px;height: 35px;" >修改</button>
		        </div>
		         <div style="padding: 2px 0px;" class="none" id="huzhu">
		         	<button class="ch-ph-btn" type="button" style="font-weight: bold;letter-spacing: 2px;height: 35px;" >立即互助</button>
		         </div>
		         <div style="padding: 2px 0px;" class="none" id="wancheng">
		         	<button class="ch-ph-btn " type="button" style="font-weight: bold;letter-spacing: 2px;height: 35px;" >确认完成</button>
		         </div>
		    </form>
		</div>
		<script src="../js/common.js"></script>
		<script src="../js/session.js"></script>

		
		<script>
			var id =getQueryString("id");
			
			var userid= getCookie("userid");
			if(!userid){
				
				alert("您还没有登录，请先登录");
//				location.href="login.html"
			}
			$(function(){
				$("#xiugai-btn").hide();
				$("#huzhu").hide();
				$("#wanchegn").hide();
				
				//读取上次填写的信息
				if(id){
					var data={};
					data.id=id;
					$.post(net+"/public/index.php?s=api/index/community_mess/",data,function(data){
		               if(data.code==200){
			               $("#title").html(data.result.title)
			               $("#addtime").html(data.result.addtime)
			               $("#endtime").html(data.result.endtime)
			               $("#linkname").html(data.result.linkname)
			               $("#linkphone").html(data.result.linkphone)
			               $("#price").html(data.result.price)
			               $("#content").html(data.result.content)
			               if(data.result.userid==userid&&data.result.is_get==0){//自己发的但没有接单
			               	    $("#xiugai-btn").show();
			               	    $("#huzhu").hide();
			               	    $("#wancheng").hide();
			               	    $("#del").show()
			               }else if(data.result.is_get==1&&data.result.userid!=userid&&data.result.is_finish==0){//不是自己发的已经接单
			               	
			               	   $("#xiugai-btn").hide();
			               	   $("#huzhu").hide();
			               	   $("#wancheng").hide();
			               	   $("#del").hide()
			               }else if(data.result.is_get==1&&data.result.userid==userid&&data.result.is_finish==0){//不是自己发的但没有接单
			                  $("#del").hide()
			               	   $("#xiugai-btn").hide();
			               	   $("#huzhu").hide();
			               	   $("#wancheng").show();
			               }else if(data.result.is_get==0&&data.result.userid!=userid&&data.result.is_finish==0){//不是自己发的但没有接单
			                  $("#del").hide()
			               	   $("#xiugai-btn").hide();
			               	   $("#huzhu").show();
			               	   $("#wancheng").hide();
			               }else if(data.result.is_finish==1&&data.result.userid==userid){//不是自己发的但没有接单
			               	   $("#del").show()
			               	   $("#xiugai-btn").hide();
			               	   $("#huzhu").hide();
			               	   $("#wancheng").hide();
			               }
		               }
				   },'json')
				}
			})
			 mui("body").on("tap","#xiugai-btn button",function(){
		    	mui.openWindow({url:"addhuzhu.html?id="+id})
	//	    	location.href=$(this).attr("data-href")
		    })
			//立即互助
			 mui("body").on("tap","#huzhu button",function(){
			 	var data={};
			 	data.id=id;
			 	data.action=1;
			 	data.member_id=userid;
		    	$.post(net+"public/index.php?s=api/index/change_community/",data,function(data){
		               if(data.code==200){
			               alert(data.message)
			               mui.openWindow({url:"huzhulist.html"})
		               }else{
		               	alert(data.message)
		               }
				   },'json')
		    })
			 //确认完成
			 mui("body").on("tap","#wancheng button",function(){
			 	var data={};
			 	data.id=id;
			 	data.action=2;
			 	data.member_id=userid;
		    	$.post(net+"public/index.php?s=api/index/change_community/",data,function(data){
		               if(data.code==200){
			               alert(data.message)
			               mui.back();
		               }else{
		               	alert(data.message)
		               }
				   },'json')
		    })
			 //删除互助
			 mui(".ding-bar").on("tap","#del",function(){
			 	var data={};
			 	data.id=id;
//			 	data.action=2;
//			 	data.member_id=userid;
		    	$.post(net+"public/index.php?s=api/index/community_del",data,function(data){
		               if(data.code==200){
			               alert(data.message)
			               mui.back();
		               }else{
		               	alert(data.message)
		               }
				   },'json')
		    })
				
		   
		</script>
	</body>

</html>